/*
 * Concept.java
 * 
 * Created on 19-jun-2007, 20:51:27
 * 
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.i2a.peacsy.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Tortuga
 */
@Entity
@Table(name = "TA_CONC_CONCEPTS")
@NamedQueries({@NamedQuery(name = "Concept.findByConcCoCode", query = "SELECT c FROM Concept c WHERE c.concCoCode = :concCoCode"), @NamedQuery(name = "Concept.findByConcLiDescription", query = "SELECT c FROM Concept c WHERE c.concLiDescription = :concLiDescription"), @NamedQuery(name = "Concept.findByAudiInSituation", query = "SELECT c FROM Concept c WHERE c.audiInSituation = :audiInSituation"), @NamedQuery(name = "Concept.findByAudiDaCreationDate", query = "SELECT c FROM Concept c WHERE c.audiDaCreationDate = :audiDaCreationDate"), @NamedQuery(name = "Concept.findByAudiLiCreationUsr", query = "SELECT c FROM Concept c WHERE c.audiLiCreationUsr = :audiLiCreationUsr"), @NamedQuery(name = "Concept.findByAudiDaUpdateDate", query = "SELECT c FROM Concept c WHERE c.audiDaUpdateDate = :audiDaUpdateDate"), @NamedQuery(name = "Concept.findByAudiLiUpdateUsr", query = "SELECT c FROM Concept c WHERE c.audiLiUpdateUsr = :audiLiUpdateUsr")})
public class Concept implements Serializable {

  @Id
  @Column(name = "CONC_CO_CODE", nullable = false)
  private Integer concCoCode;

  @Column(name = "CONC_LI_DESCRIPTION")
  private String concLiDescription;

  @Column(name = "AUDI_IN_SITUATION")
  private Short audiInSituation;

  @Column(name = "AUDI_DA_CREATION_DATE")
  @Temporal(TemporalType.TIMESTAMP)
  private Date audiDaCreationDate;

  @Column(name = "AUDI_LI_CREATION_USR")
  private String audiLiCreationUsr;

  @Column(name = "AUDI_DA_UPDATE_DATE")
  @Temporal(TemporalType.TIMESTAMP)
  private Date audiDaUpdateDate;

  @Column(name = "AUDI_LI_UPDATE_USR")
  private String audiLiUpdateUsr;

  @OneToMany(cascade = CascadeType.ALL, mappedBy = "concCoCode")
  private Collection<Entry> entryCollection;
    protected static org.apache.commons.logging.Log
        log = org.apache.commons.logging.LogFactory.getLog(Concept.class);

    public Concept() {
    }

  public Concept(Integer concCoCode) {
    this.concCoCode = concCoCode;
  }

  public Integer getConcCoCode() {
    return concCoCode;
  }

  public void setConcCoCode(Integer concCoCode) {
    this.concCoCode = concCoCode;
  }

  public String getConcLiDescription() {
    return concLiDescription;
  }

  public void setConcLiDescription(String concLiDescription) {
    this.concLiDescription = concLiDescription;
  }

  public Short getAudiInSituation() {
    return audiInSituation;
  }

  public void setAudiInSituation(Short audiInSituation) {
    this.audiInSituation = audiInSituation;
  }

  public Date getAudiDaCreationDate() {
    return audiDaCreationDate;
  }

  public void setAudiDaCreationDate(Date audiDaCreationDate) {
    this.audiDaCreationDate = audiDaCreationDate;
  }

  public String getAudiLiCreationUsr() {
    return audiLiCreationUsr;
  }

  public void setAudiLiCreationUsr(String audiLiCreationUsr) {
    this.audiLiCreationUsr = audiLiCreationUsr;
  }

  public Date getAudiDaUpdateDate() {
    return audiDaUpdateDate;
  }

  public void setAudiDaUpdateDate(Date audiDaUpdateDate) {
    this.audiDaUpdateDate = audiDaUpdateDate;
  }

  public String getAudiLiUpdateUsr() {
    return audiLiUpdateUsr;
  }

  public void setAudiLiUpdateUsr(String audiLiUpdateUsr) {
    this.audiLiUpdateUsr = audiLiUpdateUsr;
  }

  public Collection<Entry> getEntryCollection() {
    return entryCollection;
  }

  public void setEntryCollection(Collection<Entry> entryCollection) {
    this.entryCollection = entryCollection;
  }

  @Override
  public int hashCode() {
    int hash = 0;
    hash += (concCoCode != null ? concCoCode.hashCode() : 0);
    return hash;
  }

  @Override
  public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof Concept)) {
      return false;
    }
    Concept other = (Concept) object;
    if (this.concCoCode != other.concCoCode && (this.concCoCode == null || !this.concCoCode.equals(other.concCoCode))) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "org.i2a.peacsy.entity.Concept[concCoCode=" + concCoCode + "]";
  }

}
